package com.zzyweb.rentalcarsys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzyweb.rentalcarsys.entity.UserInfo;
import com.zzyweb.rentalcarsys.entity.viewobject.UserVO;
import com.zzyweb.rentalcarsys.mapper.provider.UserInfoProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {
    @Select("select ua.id, ua.username,ua.email,ua.phone_number,ui.full_name,ui.identity_number,ui.profile_picture,ui.is_delete " +
            "from user_account ua " +
            "join user_info ui on ua.id = ui.user_id where ui.is_delete = 0 ")
    IPage<UserVO> getAllUser(Page<?> page);

    @SelectProvider(type = UserInfoProvider.class, method = "selectUserByConditions")
    IPage<UserVO> getAllUserByConditions(Page<?> page, String username, String email, String phoneNumber, String name);
}
